<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html lang="zh">
<head>
<%@include file="../../commons/meta.jsp"%>
<c:set var="baseUrl" value="${ctx}api/gaokao-news/" scope="request"/>
<link rel="stylesheet" href="${ctx}assets/plugins/pure/pure-min.css" media="all" />
<script type="text/javascript" src="${ctx}assets/plugins/plupload/2.2.1/js/plupload.full.min.js"></script>
<script type="text/javascript" src="${ctx}assets/plugins/plupload/2.2.1/js/i18n/zh_CN.js"></script>
<link rel="stylesheet" href="${ctx}assets/plugins/pure/pure-min.css" media="all" />
<meta http-equiv="Content-Type" content="text/html;charset=utf-8" />
<script type="text/javascript" charset="utf-8" src="${ctx}assets/ueditor/ueditor.config.js"></script>
<script type="text/javascript" charset="utf-8" src="${ctx}assets/ueditor/ueditor.all.min.js"></script>
<!--建议手动加在语言，避免在ie下有时因为加载语言失败导致编辑器加载失败-->
<!--这里加载的语言文件会覆盖你在配置项目里添加的语言类型，比如你在配置项目里配置的是英文，这里加载的中文，那最后就是中文-->
<script type="text/javascript" charset="utf-8" src="${ctx}assets/ueditor/lang/zh-cn/zh-cn.js"></script>
<script type="text/javascript" src="${ctx}assets/plugins/My97DatePicker/WdatePicker.js"></script>
<script type="text/javascript">

  function validateForm() {
    var objs = UE.getEditor('editor').body.innerHTML;
    var content = UE.getEditor('editor').getContent();

    if (empty($('#title').val())) {
      alertError('<fmt:message key="Captions.cannot.be.empty"/>!');
      return false;
    }

    $("#content").val(objs);
    if (empty(objs.trim())) {
      alertError('<fmt:message key="Graphic.content.can.not.be.empty"/>!');
      return false;
    }
    if (empty(content.trim())) {
      alertError('<fmt:message key="Graphic.content.can.not.be.empty"/>!');
      return false;
    }
    $("#forms").submit();
  }
  //  关闭弹出框
  jQuery(document).ready(function() {
    $("#back_btn").click(function() {
      window.location.href = "${ctx}api/gaokao-news/"
    });
  });
</script>
</head>
<body>
    <%@include file="../../commons/head.jsp"%>
    <div class="content">
        <%@include file="../../commons/menu.jsp"%>
        <!--右侧展示部分-->
        <div class="right-zq">
            <!--center content-->
            <div class="dynamic">
                <div class="role dynamiclayer" style="display: block;">
                    <div class="title orange2">
                        <span class="left">高校信息管理</span>
                        <label> > </label>
                        <span>高考资讯管理</span>
                        <label> > </label>
                        <span>详情</span>
                    </div>
                    <form class="" id="forms" method="post" action="${baseUrl}update">
                        <div class="news-table">
                            <table>
                                 <tr>
                                    <td><input class="p50" id="id" name="id" type="hidden" value="${obj.id}" /></td>
                                </tr>
                                <tr>
                                    <td class="item">标题:</td>
                                    <td><input class="p50" id="title" name="title" type="text" value="${obj.title}" /></td>
                                </tr>
                                 <tr>
                                    <!-- <td class="item">点击量:</td> -->
                                    <td>
                                        <input class="p50" id="viewNum" name="viewNum" type="hidden" value="${obj.viewNum}" />
                                    </td>
                                </tr>
                                <%-- <tr>
                                    <td class="item">创建时间:</td>
                                    <td>
                                        <input class="p50" id="createTime" name="createTime" type="hidden" value="${obj.createTime}" />
                                    </td>
                                </tr> --%>
                                <div style="display: none">
                                    <textarea name="content" id="content"></textarea>
                                </div>
                                <tr>
                                    <td colspan="2" id="my_editor">
                                        <div style="width: 1000px;">
                                            <script id="editor" type="text/plain" style="height: 400px;"></script>
                                        </div>
                                    </td>
                                </tr>
                                <tr>
                                    <td> 
                                   <button class="orange2" type="button" onclick="validateForm()">
                                            <fmt:message key='sys.save' />
                                            &nbsp;<i class="fa fa-floppy-o"></i>
                                        </button> &nbsp;&nbsp;
                                        </td>
                                    <td>
                                        <button class="orange2" type="button" id="back_btn">
                                            <fmt:message key='sys.exit' />
                                            &nbsp;<i class="fa fa-undo"></i>
                                        </button>
                                    </td>
                                </tr>
                            </table>
                        </div>
                    </form>
                </div>
            </div>
            <!--center content over-->
        </div>
    </div>

    <%@include file="../../commons/footpop.jsp"%>
    <!-- 页尾，提示消息 -->
    <jsp:include page="../../commons/foot_message.jsp"></jsp:include>
    <script>
        // 初始化富文本框编辑器
        var ue = UE.getEditor('editor');
        ue.addListener("ready", function() {
          var timestamp = getTimeYMDHMSStr(${obj.createTime});
          //$("#createTime").val(timestamp);

          var content = '${obj.content}';
          ue.setContent(content);
          UE.getEditor('editor').body.innerHTML = content;
        });


    </script>
</body>
</html>
